#include "CH58x_common.h"

#define CS_PIN      GPIO_Pin_1
#define SCLK_PIN    GPIO_Pin_2
#define MOSI_PIN    GPIO_Pin_3
#define BUSY_PIN    GPIO_Pin_0

#define CS_H GPIOA_SetBits(CS_PIN)
#define CS_L GPIOA_ResetBits(CS_PIN)
#define SCLK_H GPIOA_SetBits(SCLK_PIN)
#define SCLK_L GPIOA_ResetBits(SCLK_PIN)
#define MOSI_H GPIOA_SetBits(MOSI_PIN)
#define MOSI_L GPIOA_ResetBits(MOSI_PIN)


void bit9Init(void);
void bit9WriteCmd(UINT8 d);
void bit9WriteData(UINT8 d);

void allWhite(void);
void allBlack(void);
void segTest(void);

void set_segment(uint8_t *displayData,uint8_t segment_byte, uint8_t segment_bit, uint8_t value);
void set_digit(uint8_t *displayData, uint8_t where, uint8_t digit);
void displayData(uint8_t *displayData);
void clear_digit(uint8_t *displayData,uint8_t where);
